package org.example.custom.mybatis.config;

import org.example.custom.mybatis.proxy.MapperProxy;
import org.springframework.beans.factory.FactoryBean;

import java.lang.reflect.Proxy;


public class MapperFactoryBean implements FactoryBean {

    private Class mapperClz;

    @Override
    public Object getObject() throws Exception {
        return Proxy.newProxyInstance(getClass().getClassLoader(),new Class[]{mapperClz},new MapperProxy());
    }

    @Override
    public Class<?> getObjectType() {
        return mapperClz;
    }

    public Class getMapperClz() {
        return mapperClz;
    }

    public void setMapperClz(Class mapperClz) {
        this.mapperClz = mapperClz;
    }
}
